﻿using System;
using System.Collections.Generic;
using System.Text;
using Clipping.Infrastructure.Interfaces;
using Clipping.SearchUrlConstructors;
using System.Web;

namespace Clipping.SearchUrlConstructors
{
	public class GoogleBlogUrlConstructor : ISearchUrlConstruct
	{
		private Encoding _urlEncoding = Encoding.UTF8;
		public Uri ConstructUrl(Infrastructure.Models.SearchObject searchObj)
		{
			string url = string.Format("http://www.google.com.hk/search?tbm=blg&hl=zh-CN&q={0}", HttpUtility.UrlEncode(searchObj.Keyword, this._urlEncoding));
			return new Uri(url);
		}

		public Uri ConstructAbsoluteUrl(Uri baseUri, string url)
		{
			return UriHelper.ConstructAbsoluteUrl(baseUri, url);
		}
	}
}
